/**
 * <p>
 * 表格配置
 *
 * @Author：Roy
 * @Description：碳减数据
 * @Date：Create by 2023-12-01 10:45:08
 */
// 隐藏操作按钮的规则配置，字段名：isEdit
const isHidden = (list, row) => {
  const { isEdit } = row || {}
  return list.includes(String(isEdit))
}

const headerConfig = {
  'emission-reduction-data': [
    {
      prop: 'solidifyDate',
      name: '数据时间',
      minWidth: 100,
      format: {
        type: 'date',
        showType: '{y}-{m}-{d} {h}时'
      }
    },
    {
      prop: 'projectName',
      name: '所属项目',
      minWidth: 100
    },
    {
      prop: 'sceneInfoName',
      name: '所属场景',
      minWidth: 100
    },
    {
      prop: 'deviceCode',
      name: '设备编号',
      minWidth: 100
    }, {
      prop: 'productTypeName',
      name: '统计产品类型',
      minWidth: 100
    },
    {
      prop: 'readMeterTypeName',
      name: '读表类型',
      minWidth: 100
    },
    {
      prop: 'readMeterTagName',
      name: '读表标识',
      minWidth: 100
    },
    {
      prop: 'meterValue',
      name: '计量值',
      minWidth: 100
    },
    {
      prop: 'energyTypeUnit',
      name: '单位',
      minWidth: 100
    },
    {
      prop: 'carbonEmission',
      name: '减碳量(kgCO2)',
      minWidth: 100
    }, {
      name: '等效植树量（棵）',
      minWidth: 100,
      formatter: (row, item) => {
        return parseInt(row.carbonEmission / 20.2)
      }
    },
    {
      name: '操作',
      width: 100,
      fixed: 'right',
      thStyle: { 'text-align': 'left' },
      operateList: [
        //     {
        //       type: 'btnText',
        //       label: '编辑',
        //       id: 'emission-reduction-data-edit',
        //       authId: 'ecp-admin:carbonEmissionData:update',
        //       config: { type: 'text' },
        //       style: { color: 'rgb(66, 185, 131)' },
        //       hidden: (val) => {
        //         return false // !isHidden(['1'], val)
        //       }
        //     },
        {
          type: 'btnText',
          label: '删除',
          id: 'emission-reduction-data-delete',
          authId: 'ecp-admin:emissionReductionData:deleteById',
          isMore: true,
          config: { type: 'text' },
          style: { color: '#ff0000' },
          hidden: (val) => {
            return false // !isHidden(['1'], val)
          }
        }
      ]
    }
  ]
}

export default {}
export { headerConfig }
